]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Add ShowMonitorLabels2 D-Bus API
authorJonas Ådahl <jadahl@gmail.com>
Thu, 6 Apr 2017 05:18:39 +0000 (13:18 +0800)
committerJonas Ådahl <jadahl@gmail.com>
Fri, 7 Apr 2017 14:30:35 +0000 (22:30 +0800)
Add a new D-Bus method for setting the monitor labels. This new method
takes connector names instead of output ids for associating with actual
monitors.

https://bugzilla.gnome.org/show_bug.cgi?id=777732

js/ui/osdMonitorLabeler.js
js/ui/shellDBus.js

index 90682bdf0302ec775b5321fce8d7879bc020ef5e..83a79278d70c97d4f580ff5e0d57f72fc9b2ca79 100644 (file)
@@ -120,6 +120,25 @@ const OsdMonitorLabeler = new Lang.Class({
         }
     },
 
+    show2: function(client, params) {
+        if (!this._trackClient(client))
+            return;
+
+        this._reset();
+
+        for (let connector in params) {
+            let monitor = this._monitorManager.get_monitor_for_connector(connector);
+            if (monitor == -1)
+                continue;
+            this._monitorLabels.get(monitor).push(params[connector].deep_unpack());
+        }
+
+        for (let [monitor, labels] of this._monitorLabels.entries()) {
+            labels.sort();
+            this._osdLabels.push(new OsdMonitorLabel(monitor, labels.join(' ')));
+        }
+    },
+
     hide: function(client) {
         if (!this._untrackClient(client))
             return;
index 14dba7292a92e885e9a425e14dd0367a35a6f83b..9259f8488614bc86778a809e2c3b07cbc65059f3 100644 (file)
@@ -28,6 +28,9 @@ const GnomeShellIface = '<node> \
 <method name="ShowMonitorLabels"> \
     <arg type="a{uv}" direction="in" name="params" /> \
 </method> \
+<method name="ShowMonitorLabels2"> \
+    <arg type="a{sv}" direction="in" name="params" /> \
+</method> \
 <method name="HideMonitorLabels" /> \
 <method name="FocusApp"> \
     <arg type="s" direction="in" name="id"/> \
@@ -250,6 +253,12 @@ const GnomeShell = new Lang.Class({
         Main.osdMonitorLabeler.show(sender, dict);
     },
 
+    ShowMonitorLabels2Async: function(params, invocation) {
+        let sender = invocation.get_sender();
+        let [dict] = params;
+        Main.osdMonitorLabeler.show2(sender, dict);
+    },
+
     HideMonitorLabelsAsync: function(params, invocation) {
         let sender = invocation.get_sender();
         Main.osdMonitorLabeler.hide(sender);